package wangjg.sso.util;

import java.util.Date;

import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.processors.JsonBeanProcessor;

public class MyDateJsonBeanProcessor implements JsonBeanProcessor{
	
	private boolean forjs=true;
	
	public MyDateJsonBeanProcessor(boolean forjs){
		this.forjs = forjs;
	}

	@Override
	public JSONObject processBean(Object bean, JsonConfig jsonConfig) {
		Date date=(Date)bean;
//		if(this.forjs){
//			return new JSONObject("new Date("+date.getTime()+")");	
//		}else{
//			return new JSONObject(""+date.getTime());
//		}
		return JSONObject.fromObject(date.getTime());
	}

}

//class MyJSONObject extends JSONObject{
//	private String str;
//	
//	public MyJSONObject(String str) {
//		this.str = str;
//	}
//
//	public String toString() {
//		return str;
//	}
//	public String toString( int indentFactor ) {
//		return this.toString();
//	}
//	public String toString( int indentFactor, int indent ) {
//		return this.toString();
//	}
//}
